package com.example.blog.config;

import com.example.blog.Interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    private List<String> list=List.of("/user/login","/**/.html"
            ,"/css/**"
            ,"/blog-editormd/**"
            ,"/js/**"
            ,"/pic/**"
            ,"/static/**" );

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(loginInterceptor).addPathPatterns("/user/**","/Blog/**")
//               .addPathPatterns("/**")
               .excludePathPatterns("/user/login");



//               .excludePathPatterns("/user/login")
//               .excludePathPatterns("/blog_login.html")
//                .excludePathPatterns("/**/*css")
//                .excludePathPatterns("/**/*js");
    }
}
